[make:controller] avoid require doctrine/annotation when can use attributes#858
Conversation
src/Maker/MakeController.php
Outdated
| if (null === $phpCompatUtil) { | ||
| $phpCompatUtil = new PhpCompatUtil($fileManager); | ||
|
|
||
| trigger_deprecation('symfony/maker-bundle', '1.31', 'Initializing MakeController without providing an instance of PhpCompatUtil is deprecated.'); |
There was a problem hiding this comment.
This is heavily inspired on https://github.com/symfony/maker-bundle/blob/main/src/Generator.php#L40, tell me if it's not needed in this case
There was a problem hiding this comment.
I'm not sure if it is worth it. When maker-bundle will require PHP 8 as a minimum version, we'll most likely drop the dependency to PhpCompatUtil, so in my opinion it's not useful to make this dependency mandatory.
There was a problem hiding this comment.
No need for the deprecation here. PhpCompatUtil is internal & MakeController is final - I don't see a use case where someone would use a version >=1.31 and not be able to initiate MakeController w/o the utility.
There was a problem hiding this comment.
Deprecation removed 👌
jrushlow
left a comment
There was a problem hiding this comment.
Thanks @Jibbarth This PR will have to wait for the resolution of symfony/recipes#916 before it can be merged.
So maybe we should create the config/routes/annotation.yaml in case we can use attributes AND file does not exist ? WDYT ?
I'm not a fan of this idea. That responsibility falls on recipes / flex in my opinion.
src/Maker/MakeController.php
Outdated
| if (null === $phpCompatUtil) { | ||
| $phpCompatUtil = new PhpCompatUtil($fileManager); | ||
|
|
||
| trigger_deprecation('symfony/maker-bundle', '1.31', 'Initializing MakeController without providing an instance of PhpCompatUtil is deprecated.'); |
There was a problem hiding this comment.
No need for the deprecation here. PhpCompatUtil is internal & MakeController is final - I don't see a use case where someone would use a version >=1.31 and not be able to initiate MakeController w/o the utility.
4d63ab8 to
37472d7
Compare
37472d7 to
abbfa18
Compare
|
Note: To preserve BC, |
Hi makers 👋 !
This PR allows to make controller when we can use PHP8 attributes without forcing to install
doctrine/annotationBut we should be aware that currently, without
doctrine/annotation, we don't have a nice flex recipe that enable routing annotation read on Controller folder.See symfony/recipes#916 for reference.
So maybe we should create the config/routes/annotation.yaml in case we can use attributes AND file does not exist ? WDYT ?